<template>
  <div id="search">  
  
  <el-form ref="form"  label-width="0px">  
    <el-row>
        <el-col :span="20" style="display:flex;">
              <el-form-item label="" style="margin-left:5px;">
                <el-select  v-model="form.select_td_num" placeholder="请选择团队" style="width:150px;">
                    <el-option  v-for="(item,index) in select_td_data" :key="index" :label="item.telphone" :value="item.uid" ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="" label-width="0px" style="margin-left:5px;">
                <div style="display: flex;">
                      <el-date-picker  type="date"  placeholder="开始日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time1" style="width:140px;"></el-date-picker>
                       <div style="width:20px;height:40px;line-height:40px;text-align: center;"> - </div>
                      <el-date-picker  type="date"  placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time2" style="width: 140px;"></el-date-picker>
                </div>
            </el-form-item> 
            <el-form-item label-width="0px" label="" style="margin-left:5px;">
                <el-input v-model="form.day1" :placeholder="'总卖' + variable_name4 + '天数'" style="width:110px;"></el-input>
            </el-form-item>

            <el-form-item label-width="0px" label="" style="margin-left:5px;">
                <el-input v-model="form.day2"  :placeholder="'总买' + variable_name4 + '天数'" style="width:110px;"></el-input>
            </el-form-item>

             <el-form-item label-width="0px" label="" style="margin-left:5px;">
                <el-input v-model="form.telphone" placeholder="手机号" style="width:130px;"></el-input>
            </el-form-item>

             <div class="custom_button2"  style="margin-left:5px;" @click="search_but"></div>
        </el-col> 
          <el-col :span="4" style="text-align: right;">
         <el-button class="custom_color_button" type="primary" @click="refresh_but()">刷新</el-button>
        </el-col>  
  </el-row>



  </el-form >

   <!-- 渲染数据list -->
   <search-list :datalist="datalist" @up_list_fun="list_fun"> </search-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>
      
  </div>
</template>

<script>
import SearchList from '@/view/Search/SearchList'
export default {
  name: 'search',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,              
        select_td_data:[],
        form:{
            select_td_num:'',
            time1:'',
            time2:'',
            day1:'',
            day2:'',
            telphone:'',
        }
    }
  },
 components:{
    SearchList
  },
  created(){
      this.list_fun()
      this.td_list()
  }, 
  mounted (){
    
  },
  methods: {
     td_list(){
        this.post("/Statistics/listOfLeader", {
        
	        }).then(res => {
            this.select_td_data = res.result       
            //console.log(this.select_td_data)
         })
     },
     list_fun(){
          this.post("/Statistics/memberlist", {
              page:this.page,
              start_time:this.form.time1,
              team_uid:this.form.select_td_num,
              end_time:this.form.time2,
              sale_number:this.form.day1,
              buy_number:this.form.day2,
              telphone:this.form.telphone
	        }).then(res => {
            this.count = res.result.count[0].count
            this.datalist = res.result.list
          
            
           // console.log(res,"dddsss")
         })
      },
       search_but(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form={
            select_td_num:'',
            time1:'',
            time2:'',
            day1:'',
            day2:'',
            telphone:'',
        }
        this.list_fun()
      },
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>

</style>
